import request from '@/utils/request'
// import store from '@/store'
export const login = data =>
  request({
    method: 'POST',
    url: '/v1_0/authorizations',
    data,
  })
export const sendSms = mobile =>
  request({
    method: 'GET',
    url: `/v1_0/sms/codes/${mobile}`,
  })
export const getUserInfo = () =>
  request({
    method: 'GET',
    url: '/v1_0/user',
    // headers: {
    //   Authorization: `Bearer ${store.state.user.token}`,
    // },
  })
export const getUserChannels = () =>
  request({
    method: 'GET',
    url: '/v1_0/user/channels',
  })
export const addFollow = target =>
  request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
      target,
    },
  })
export const delFollow = target =>
  request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${target}`,
  })
export const getUserProfile = () =>
  request({
    method: 'GET',
    url: '/v1_0/user/profile',
  })
export const updateUserProfile = data =>
  request({
    method: 'PATCH',
    url: '/v1_0/user/profile',
    data,
  })
export const updateUserPhoto = data =>
  request({
    method: 'PATCH',
    url: '/v1_0/user/photo',
    data,
  })
